
import Http from "./axios";
import api from "./api";

const server = (import.meta.env.VITE_APP_BASE_API || "").trim();
const host = server; 

// 深拷贝并拼接 host
const wrapped: any = {};
Object.keys(api).forEach((groupKey) => {
  wrapped[groupKey] = {};
  Object.keys((api as any)[groupKey]).forEach((itemKey) => {
    wrapped[groupKey][itemKey] = host + (api as any)[groupKey][itemKey];
  });
});

const serverApi = Http(wrapped);

export default serverApi;
